package com.baidu.comment.pojo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * 分页请求封装
 */
@NoArgsConstructor
@AllArgsConstructor
@Data
@ApiModel(description = "分页查询条件",value = "PageRequestDto")
public class PageRequestDto<T> implements Serializable {
    //当前页码
    @ApiModelProperty(notes = "当前页")
    private Long page = 1L;
    //每页显示的行
    @ApiModelProperty(notes = "每页查询条数")
    private Long size = 10L;
    //请求体实体对象
    @ApiModelProperty(notes = "查询条件")
    private T body;

    /***
     * 计算下标
     */
    public Long getStart(){
        return (page-1)*size;
    }
}
